<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
//创建数组并赋值
    let arr=[23,566,21,542,78];
    console.log(arr[2]);//21,arr[]从0开始 
    let arr2=['tom' ,34.4,true,,,,]; 
    console.log(arr2[4]); 
    arr2[4]=null;
    console.log(arr2[4]); 
    console.log('-------------------------------------------');
//遍历数组
    // console.log(arr);
    console.log(arr.length);//获取数组长度 
    for(let i=0;i<arr.length;i++){
        console.log(arr[i]);
    }
    console.log('--------------------------------------------');	
    //找出数组score中最大值，并算出这个数组的平均数
    //score=[89,67,59,90,54,77,83,88.5,43,10,68];
    let score=[89,67,59, 90,54,77,83,88.5,43,10,68]; 
    let max=score[0]; 
    let sum=0;
    for(let i=0;i<score.length;i++){ 
        if(score[i]>max){ 
            max=score[i];
        }
      //sum=sum+score[i];
      sum+=score[i];//求和的两种表达	
    }	
    let avg=sum/score.length;
    console.log('最大值是:'+max);	
    console.log('平均分数是:'+avg);
    console.log('-----------------------------------------');	
//添加数组元素	
    score[1000]=88;
    console.log(score[1000]);	
    console.log(score.length);	
    for(let i=0;i<score.length;i++){	
        console.log(score[i]);	
    }
//删除数组元素	
        delete score[1000];	
        console.log(score[1000]);	

</script>	
</html>